import 'package:bruno/bruno.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:xiongmao_clean_flutter_module/business/common/insure/page/aotu_Insure_page.dart';

import '../../../../res/colors.dart';
import 'Insure_history_page.dart';
import 'Insure_market_page.dart';

/**
 * 保险商城
 */
class InsurePage extends StatefulWidget {
  @override
  _InsurePageState createState() => _InsurePageState();
}

class _InsurePageState extends State<InsurePage> {
  int currentIndex = 0;

  void _onTabChanged(int index) {
    setState(() {
      currentIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: BrnAppBar(title: '保险',),
      body: Column(
        children: <Widget>[
          BrnSwitchTitle(
            nameList: ['保险商城', '自动投保', '历史保单'],
            defaultSelectIndex: currentIndex,
            onSelect: _onTabChanged,
          ),
          Expanded(
            child: currentIndex == 0
                ? InsureMarketPage() // 保险商城界面内容
                : currentIndex == 1
                    ? AutoInsurePage() // 自动投保界面内容
                    : InsureHistoryPage(), // 历史保单界面内容
          ),
        ],
      ),
    );
  }
}
